import jwtDecode from 'jwt-decode'
const tokenKey = 'wyj_access_token'

// 获取token
export function getToken () {
  return localStorage.getItem(tokenKey)
}

// 设置token
export function setToken (value) {
  localStorage.setItem(tokenKey, value)
}

// 清除token
export function removeToken () {
  localStorage.removeItem(tokenKey)
}

// 验证是否
export function isAuth () {
  if (getToken()) { return true } else { return false }
}

// 解析token
export function getTokenValueData () {
  const token = getToken()
  if (token) { return jwtDecode(token) }
  return null
}
